import request from '@/utils/request'

export function get_account_titles(query) {
  return request({
    url: '/finance/account/',
    method: 'GET',
    params: query
  })
}

export function addAccountTitle(accountInfo){
  return request({
    url: '/finance/account/',
    method: 'POST',
    data: accountInfo
  })
}

export function updateAccountTitle(accountInfo){
  return request({
    url: `/finance/account/${accountInfo.id}/`,
    method: 'PATCH',
    data: accountInfo
  })
}

export function delAccountTitle(account_id){
  return request({
    url: `/finance/account/${account_id}/`,
    method: 'DELETE',
  })
}

//科目编码
export function getAccountCodes(params) {
  return request({
    url: '/finance/code/',
    method: 'GET',
    params
  })
}

export function addAccountCode(data){
  return request({
    url: '/finance/code/',
    method: 'POST',
    data
  })
}

export function updateAccountCode(data){
  return request({
    url: `/finance/code/${data.code}/`,
    method: 'PATCH',
    data
  })
}

export function delAccountCode(data_id){
  return request({
    url: `/finance/code/${data_id}/`,
    method: 'DELETE',
  })
}

export function AccountCodeList(params){
  return request({
    url: '/finance/code_list/',
    method: 'GET',
    params
  })
}